From: Alessandro Bono Date: Sat, 21 Oct 2023 11:31:42 +0000 (+0200) Subject: popupMenu: Use duration 0 when not animating X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~281^2~2^2~343 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=46219b1101a0a9ce9a2881d7582dd7e227e1a65c;p=gnome-shell.git popupMenu: Use duration 0 when not animating Instead of using a special branch for the not animate case, just use the same path with duration 0. Since commit ee09c5c85312f571e14abe69bb6674a361c16d65 we are sure that duration 0 is always preserved. Part-of: --- diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 60da5460d..b2a3c4a48 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -1076,23 +1076,20 @@ export class PopupSubMenu extends PopupMenuBase { let targetAngle = this.actor.text_direction === Clutter.TextDirection.RTL ? -90 : 90; - if (animate) { - let [, naturalHeight] = this.actor.get_preferred_height(-1); - this.actor.height = 0; - this.actor.ease({ - height: naturalHeight, - duration: 250, - mode: Clutter.AnimationMode.EASE_OUT_EXPO, - onComplete: () => this.actor.set_height(-1), - }); - this._arrow.ease({ - rotation_angle_z: targetAngle, - duration: 250, - mode: Clutter.AnimationMode.EASE_OUT_EXPO, - }); - } else { - this._arrow.rotation_angle_z = targetAngle; - } + const duration = animate ? 250 : 0; + let [, naturalHeight] = this.actor.get_preferred_height(-1); + this.actor.height = 0; + this.actor.ease({ + height: naturalHeight, + duration, + mode: Clutter.AnimationMode.EASE_OUT_EXPO, + onComplete: () => this.actor.set_height(-1), + }); + this._arrow.ease({ + rotation_angle_z: targetAngle, + duration, + mode: Clutter.AnimationMode.EASE_OUT_EXPO, + }); } close(animate) { @@ -1108,25 +1105,21 @@ export class PopupSubMenu extends PopupMenuBase { if (animate && this._needsScrollbar()) animate = false; - if (animate) { - this.actor.ease({ - height: 0, - duration: 250, - mode: Clutter.AnimationMode.EASE_OUT_EXPO, - onComplete: () => { - this.actor.hide(); - this.actor.set_height(-1); - }, - }); - this._arrow.ease({ - rotation_angle_z: 0, - duration: 250, - mode: Clutter.AnimationMode.EASE_OUT_EXPO, - }); - } else { - this._arrow.rotation_angle_z = 0; - this.actor.hide(); - } + const duration = animate ? 250 : 0; + this.actor.ease({ + height: 0, + duration, + mode: Clutter.AnimationMode.EASE_OUT_EXPO, + onComplete: () => { + this.actor.hide(); + this.actor.set_height(-1); + }, + }); + this._arrow.ease({ + rotation_angle_z: 0, + duration, + mode: Clutter.AnimationMode.EASE_OUT_EXPO, + }); } _onKeyPressEvent(actor, event) {